From: Claudio Cambra Date: Mon, 10 Feb 2025 07:07:05 +0000 (+0800) Subject: gui/macOS: Fix accountIdFromDomainId X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~2^2~78^2~2 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=dfc0eb692348282a36d31a0284614e0066dfe0f4;p=nextcloud-desktop.git gui/macOS: Fix accountIdFromDomainId Signed-off-by: Claudio Cambra --- diff --git a/src/gui/macOS/fileproviderdomainmanager_mac.mm b/src/gui/macOS/fileproviderdomainmanager_mac.mm index d1660810a..1c033554d 100644 --- a/src/gui/macOS/fileproviderdomainmanager_mac.mm +++ b/src/gui/macOS/fileproviderdomainmanager_mac.mm @@ -104,7 +104,21 @@ QString accountIdFromDomainId(const QString &domainId) QString accountIdFromDomainId(NSString * const domainId) { - return accountIdFromDomainId(QString::fromNSString(domainId)); + auto qDomainId = QString::fromNSString(domainId); + if (!qDomainId.contains('-')) { + return qDomainId.replace("(.)", "."); + } + // Using slashes as the replacement for illegal chars was unwise and we now have to pay the + // price of doing so... + const auto accounts = OCC::AccountManager::instance()->accounts(); + for (const auto &accountState : accounts) { + const auto account = accountState->account(); + const auto convertedDomainId = domainIdentifierForAccount(account); + if (convertedDomainId == qDomainId) { + return account->userIdAtHostWithPort(); + } + } + Q_UNREACHABLE(); } API_AVAILABLE(macos(11.0))